package ue.web.sys;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import ue.util.SessionUtils;

@Controller
public class IndexController {
	
	@RequestMapping("/index")
	public String sysIndex(HttpServletRequest request){
		
	    
		return "index";
	}
	
	
	@RequestMapping("/login")
	@ResponseBody
	public Object Login(HttpServletRequest request,Integer userId){
		SessionUtils.putUser(userId);
	    
		return userId;
	}
	
	@RequestMapping("/test")
	public String test(HttpServletRequest request,Integer userId,Model model){
		Integer currentUserId = SessionUtils.getUserId();
		
		model.addAttribute("currentUserId", currentUserId);
		
		return "test";
	}

}
